package Array.Rotate;


public class Rotate {
    public void rotate(int[] nums, int k) {
        if (nums == null || nums.length == 0 || k % nums.length <= 0)
            return;
        k = k % nums.length;

        int[] temp = new int[k];
        System.arraycopy(nums, nums.length - k, temp, 0, k);
        System.arraycopy(nums, 0, nums, k, nums.length - k);
        System.arraycopy(temp, 0, nums, 0, k);
    }

}
